package com.example.websocketproject.controller;

import com.example.websocketproject.domain.CharRoom;
import com.example.websocketproject.service.CharService;
import com.example.websocketproject.util.ResultView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author 吴 da ~
 * @data 2021/3/4 15:12
 */
@RestController
public class CharController {

    @Autowired
    public CharService charService;


    /**
     * 查找房间
     */
    @RequestMapping("/charRoom/check")
    public ResultView checkRoom(){
        return new ResultView<>(charService.chechInfo());
    }

    /**
     * 添加房间
     */
    @RequestMapping("/charRoom/add")
    public ResultView addRoom(@RequestBody CharRoom charRoom){
        return new ResultView<>(charService.addRoom(charRoom));
    }

    /**
     * 删除房间
     */
    @RequestMapping("/charRoom/del")
    public ResultView delRoom(@RequestBody CharRoom charRoom){
        return new ResultView<>(charService.delRoom(charRoom));
    }

}
